========================================================================
       STATIC LIBRARY : DfUsbLib
========================================================================

The file PortMan.cpp contains the main interface to the ports.
The class CPortMan maintains a port object which can be 
CPortCom for regular ComPorts
or one of the HID stuff
CPortHidCom	
	(a simple serial simulation using HID. Compatible to an example from Cypress)
CPortHidPos
	(The USB way to connect barcode readers.)
CPortHidSurePosSio
	(SurePos is a trademark of IBM. It is a name for cash registers.
	 This interface works in conjunction of the SIO part for these.)
More can be added: more HID flavours, simple bulk, FTDI direct driver,...
All the various interfaces are hidden from the user.

There are also a few dialog boxes and other helpers.
CEnumComm	lists all installed com ports
CEnumHid		lists all installed HID devices of the above flavours
Both are used by the CPortMan to create a list of all available devices.
Use this function to show that list to the user:
	static void FillPortBox( CComboBox *combo, CString CurrentPort, bool bDeleteFirst=true );
It fills a CComboBox with all available devices.
The box contains strings like these:
	COM1   Communications Port
	COM18  USB Serial Port
	COM3   VScom COM Port
	COM8   IT5600 Linear Imager
	IT4600 - SerNum12345
	TT8800 Transaction Terminal - SerNum12345

COM1 is the std. com port on the main board.
COM18 is a USB to RS232 addapter from FTDI.
COM3 is a PCI card with com ports (16C950 based)
COM8 is a USB barcode reader with a true com port emulation.
IT4600 is a USB HID device (IT4600 barcode reader).
TT8800 is a signature capture device for the SurePos cash registers.
You see, all kinds of devices are presented in a similar way.

The user then selects a port or device.

There are specialities like translating baud rates to support non-std cards and
a feature to hide certain devices (AVMISDN is something that you do not want to
see in that list).

How to open and use the port?
Add an instance of the CPortMan to your view/dialog.
	CPortManGui *pPort = new CPortManGui;

	pPort->OnOptions();			// Opens the port selection dialog and selects the port.
	
	pPort->SetupConnection();	// Opens the port for reading and writing
	.....
	pPort->CloseConnection();	// Cleanup when you are done


There are some overloads for the Open function.
Read functions:
	int	Read( LPSTR lpszBlock, int nMaxLength );		// wait according the timeout settings
	int	ReadBlock( LPSTR lpszBlock, int nMaxLength );	// no wait, returns what is there
	int	Read( int &byte );
Note: ReadBlock does not wait. It checks how many characters are in the 
RX fifo and reads this amount. The other two read functions us the CommTimeOut settings.

Write functions:
	bool 	Write ( BYTE bByte );
	bool 	Write( LPCSTR str, DWORD size );
	bool 	Write( CStringA sText );

	Usage:
	pPort->Write ('A');
	
	const char *szText="Hello World";
	pPort->Write (szText, strlen(szText));

	CStringA sText="Hello World";
	pPort->Write (sText);

You can also register a callback for RX, error or status change.
Or you can choose to receive a windows message for these events.
There is a back ground thread that handles these events.


See the example SimpleTerm.

/////////////////////////////////////////////////////////////////////////////
